package com.soft.mainsite.component.beetl.tag;

import com.google.common.collect.Maps;
import org.beetl.core.TagFactory;
import org.beetl.ext.spring.SpringBeanTagFactory;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

import java.util.Map;

/**
 * Description:aa
 *
 * @author Jin
 * @create 2017-06-03
 **/
@Component
public class TagRegisterFactory {


    /**
     * 内容列表标签
     *
     * @return
     */
    @Bean(name = "contentListTagFactory")
    public SpringBeanTagFactory contentListTagFactory() {
        SpringBeanTagFactory springBeanTagFactory = new SpringBeanTagFactory();
        springBeanTagFactory.setName("contentListTag");
        return springBeanTagFactory;
    }

    /**
     * 内容分页标签
     *
     * @return
     */
    @Bean(name = "contentPageTagFactory")
    public SpringBeanTagFactory contentPageTagFactory() {
        SpringBeanTagFactory springBeanTagFactory = new SpringBeanTagFactory();
        springBeanTagFactory.setName("contentPageTag");
        return springBeanTagFactory;
    }

    /**
     * 分页标签
     *
     * @return
     */
    @Bean(name = "paginationTagFactory")
    public SpringBeanTagFactory paginationTagFactory() {
        SpringBeanTagFactory springBeanTagFactory = new SpringBeanTagFactory();
        springBeanTagFactory.setName("paginationTag");
        return springBeanTagFactory;
    }

    @Bean(name = "contentTagFactory")
    public SpringBeanTagFactory contentTagFactory() {
        SpringBeanTagFactory springBeanTagFactory = new SpringBeanTagFactory();
        springBeanTagFactory.setName("contentTag");
        return springBeanTagFactory;
    }

    @Bean(name = "categoryListTagFactory")
    public SpringBeanTagFactory categoryListTagFactory() {
        SpringBeanTagFactory springBeanTagFactory = new SpringBeanTagFactory();
        springBeanTagFactory.setName("categoryListTag");
        return springBeanTagFactory;
    }

    @Bean(name = "categoryTagFactory")
    public SpringBeanTagFactory categoryTagFactory() {
        SpringBeanTagFactory springBeanTagFactory = new SpringBeanTagFactory();
        springBeanTagFactory.setName("categoryTag");
        return springBeanTagFactory;
    }


    @Bean(name = "printSitePositionTagFactory")
    public SpringBeanTagFactory printSitePositionTagFactory() {
        SpringBeanTagFactory springBeanTagFactory = new SpringBeanTagFactory();
        springBeanTagFactory.setName("printSitePositionTag");
        return springBeanTagFactory;
    }

    @Bean(name = "searchModelFiledValueTagFactory")
    public SpringBeanTagFactory searchModelFiledValueTagFactory() {
        SpringBeanTagFactory springBeanTagFactory = new SpringBeanTagFactory();
        springBeanTagFactory.setName("searchModelFiledValueTag");
        return springBeanTagFactory;
    }

    @Bean(name = "lucenePageTagFactory")
    public SpringBeanTagFactory lucenePageTagFactory() {
        SpringBeanTagFactory springBeanTagFactory = new SpringBeanTagFactory();
        springBeanTagFactory.setName("lucenePageTag");
        return springBeanTagFactory;
    }


    /**
     * 分页标签
     *
     * @return
     */
    @Bean(name = "lucenePaginationTagFactory")
    public SpringBeanTagFactory lucenePaginationTagFactory() {
        SpringBeanTagFactory springBeanTagFactory = new SpringBeanTagFactory();
        springBeanTagFactory.setName("lucenePaginationTag");
        return springBeanTagFactory;
    }

    /**
     * 分页标签
     *
     * @return
     */
    @Bean(name = "indexSilderTagFactory")
    public SpringBeanTagFactory indexSilderTagFactory() {
        SpringBeanTagFactory springBeanTagFactory = new SpringBeanTagFactory();
        springBeanTagFactory.setName("indexSilderTag");
        return springBeanTagFactory;
    }


    @Bean(name = "topicListTagFactory")
    public SpringBeanTagFactory topicListTagFactory() {
        SpringBeanTagFactory springBeanTagFactory = new SpringBeanTagFactory();
        springBeanTagFactory.setName("topicListTag");
        return springBeanTagFactory;
    }

    @Bean(name = "topicContentTagFactory")
    public SpringBeanTagFactory topicContentTagFactory() {
        SpringBeanTagFactory springBeanTagFactory = new SpringBeanTagFactory();
        springBeanTagFactory.setName("topicContentTag");
        return springBeanTagFactory;
    }


    /**
     * 友情链接标签
     *
     * @return
     */
    @Bean(name = "friendLinkListTagFactory")
    public SpringBeanTagFactory friendLinkListTagFactory() {
        SpringBeanTagFactory springBeanTagFactory = new SpringBeanTagFactory();
        springBeanTagFactory.setName("friendLinkListTag");
        return springBeanTagFactory;
    }

    /**
     * 首页推荐列表标签
     *
     * @return
     */
    @Bean(name = "recommendContentListFactory")
    public SpringBeanTagFactory recommendContentListFactory() {
        SpringBeanTagFactory springBeanTagFactory = new SpringBeanTagFactory();
        springBeanTagFactory.setName("recommendContentListTag");
        return springBeanTagFactory;
    }

    /**
     * 栏目别名标签
     *
     * @return
     */
    @Bean(name = "categoryAliasFactory")
    public SpringBeanTagFactory categoryAliasFactory() {
        SpringBeanTagFactory springBeanTagFactory = new SpringBeanTagFactory();
        springBeanTagFactory.setName("categoryAliasTag");
        return springBeanTagFactory;
    }

    /**
     * 站点信息标签
     *
     * @return
     */
    @Bean(name = "siteInfoFactory")
    public SpringBeanTagFactory siteInfoFactory() {
        SpringBeanTagFactory springBeanTagFactory = new SpringBeanTagFactory();
        springBeanTagFactory.setName("siteInfoTag");
        return springBeanTagFactory;
    }

    /**
     * 专题栏目信息标签
     */
    @Bean(name = "topicInfoFactory")
    public SpringBeanTagFactory topicInfoFactory() {
        SpringBeanTagFactory springBeanTagFactory = new SpringBeanTagFactory();
        springBeanTagFactory.setName("topicInfoTag");
        return springBeanTagFactory;
    }

    /**
     * 城市列表标签
     *
     * @return
     */
    @Bean(name = "cityListFactory")
    public SpringBeanTagFactory cityListFactory() {
        SpringBeanTagFactory springBeanTagFactory = new SpringBeanTagFactory();
        springBeanTagFactory.setName("cityListTag");
        return springBeanTagFactory;
    }

    /**
     * 城市信息标签
     *
     * @return
     */
    @Bean(name = "cityInfoFactory")
    public SpringBeanTagFactory cityInfoFactory() {
        SpringBeanTagFactory springBeanTagFactory = new SpringBeanTagFactory();
        springBeanTagFactory.setName("cityInfoTag");
        return springBeanTagFactory;
    }

    /**
     * 新增页动态展示标签
     *
     * @return
     */
    @Bean(name = "viewShowFactory")
    public SpringBeanTagFactory viewShowFactory() {
        SpringBeanTagFactory springBeanTagFactory = new SpringBeanTagFactory();
        springBeanTagFactory.setName("viewShowTag");
        return springBeanTagFactory;
    }

    /**
     * 内容详情标签
     *
     * @return
     */
    @Bean(name = "contentDetailsFactory")
    public SpringBeanTagFactory contentDetailsFactory() {
        SpringBeanTagFactory springBeanTagFactory = new SpringBeanTagFactory();
        springBeanTagFactory.setName("contentDetailsTag");
        return springBeanTagFactory;
    }

    /**
     * 内容作为多选列表
     *
     * @return
     */
    @Bean(name = "contentSelectFactory")
    public SpringBeanTagFactory contentSelectFactory() {
        SpringBeanTagFactory springBeanTagFactory = new SpringBeanTagFactory();
        springBeanTagFactory.setName("contentSelectTag");
        return springBeanTagFactory;
    }

    /**
     * 旗舰店列表标签
     *
     * @return
     */
    @Bean(name = "flagshipShopListTagFactory")
    public SpringBeanTagFactory flagshipShopListTagFactory() {
        SpringBeanTagFactory springBeanTagFactory = new SpringBeanTagFactory();
        springBeanTagFactory.setName("flagshipShopListTag");
        return springBeanTagFactory;
    }

    /**
     * 站点区县列表标签
     *
     * @return
     */
    @Bean(name = "districtListTagFactory")
    public SpringBeanTagFactory districtListTagFactory() {
        SpringBeanTagFactory springBeanTagFactory = new SpringBeanTagFactory();
        springBeanTagFactory.setName("districtListTag");
        return springBeanTagFactory;
    }


    /**
     * TagFactory
     *
     * @param contentListTag
     * @param contentPageTag
     * @param paginationTag
     * @param contentTag
     * @param categoryListTag
     * @param categoryTag
     * @param searchModelFiledValueTag
     * @param printSitePositionTagFactory
     * @param lucenePageTagFactory
     * @param lucenePaginationTagFactory
     * @param indexSilderTagFactory
     * @param topicListTagFactory
     * @param topicContentTagFactory
     * @param friendLinkListTagFactory
     * @param recommendContentListFactory
     * @param categoryAliasFactory
     * @param siteInfoFactory
     * @param topicInfoFactory
     * @param cityListFactory
     * @param cityInfoFactory
     * @param viewShowFactory
     * @param contentDetailsFactory
     * @param contentSelectFactory
     * @param flagshipShopListTag
     * @param districtListTag
     * @return
     */
    @Bean(name = "tagFactory")
    public Map<String, TagFactory> tag(@Qualifier("contentListTagFactory") SpringBeanTagFactory contentListTag,
                                       @Qualifier("contentPageTagFactory") SpringBeanTagFactory contentPageTag,
                                       @Qualifier("paginationTagFactory") SpringBeanTagFactory paginationTag,
                                       @Qualifier("contentTagFactory") SpringBeanTagFactory contentTag,
                                       @Qualifier("categoryListTagFactory") SpringBeanTagFactory categoryListTag,
                                       @Qualifier("categoryTagFactory") SpringBeanTagFactory categoryTag,
                                       @Qualifier("searchModelFiledValueTagFactory") SpringBeanTagFactory searchModelFiledValueTag,
                                       @Qualifier("printSitePositionTagFactory") SpringBeanTagFactory printSitePositionTagFactory,
                                       @Qualifier("lucenePageTagFactory") SpringBeanTagFactory lucenePageTagFactory,
                                       @Qualifier("lucenePaginationTagFactory") SpringBeanTagFactory lucenePaginationTagFactory,
                                       @Qualifier("indexSilderTagFactory") SpringBeanTagFactory indexSilderTagFactory,
                                       @Qualifier("topicListTagFactory") SpringBeanTagFactory topicListTagFactory,
                                       @Qualifier("topicContentTagFactory") SpringBeanTagFactory topicContentTagFactory,
                                       @Qualifier("friendLinkListTagFactory") SpringBeanTagFactory friendLinkListTagFactory,
                                       @Qualifier("recommendContentListFactory") SpringBeanTagFactory recommendContentListFactory,
                                       @Qualifier("categoryAliasFactory") SpringBeanTagFactory categoryAliasFactory,
                                       @Qualifier("siteInfoFactory") SpringBeanTagFactory siteInfoFactory,
                                       @Qualifier("topicInfoFactory") SpringBeanTagFactory topicInfoFactory,
                                       @Qualifier("cityListFactory") SpringBeanTagFactory cityListFactory,
                                       @Qualifier("cityInfoFactory") SpringBeanTagFactory cityInfoFactory,
                                       @Qualifier("viewShowFactory") SpringBeanTagFactory viewShowFactory,
                                       @Qualifier("contentDetailsFactory") SpringBeanTagFactory contentDetailsFactory,
                                       @Qualifier("contentSelectFactory") SpringBeanTagFactory contentSelectFactory,
                                       @Qualifier("flagshipShopListTagFactory") SpringBeanTagFactory flagshipShopListTag,
                                       @Qualifier("districtListTagFactory") SpringBeanTagFactory districtListTag
    ) {
        Map<String, TagFactory> tag = Maps.newHashMap();
        tag.put("cms_content_list", contentListTag);
        tag.put("cms_content_page", contentPageTag);
        tag.put("cms_pagination", paginationTag);
        tag.put("cms_content", contentTag);
        tag.put("cms_category_list", categoryListTag);
        tag.put("cms_category", categoryTag);
        tag.put("cms_modelfiled_find", searchModelFiledValueTag);
        tag.put("cms_site_pos", printSitePositionTagFactory);
        tag.put("cms_lucene_page", lucenePageTagFactory);
        tag.put("cms_lucene_pagination", lucenePaginationTagFactory);
        tag.put("cms_index_silder", indexSilderTagFactory);
        tag.put("cms_topic_list", topicListTagFactory);
        tag.put("cms_topic_content", topicContentTagFactory);
        tag.put("cms_friendlink", friendLinkListTagFactory);
        tag.put("cms_category_alias", categoryAliasFactory);
        tag.put("recommend_content_list", recommendContentListFactory);
        tag.put("site_Info", siteInfoFactory);
        tag.put("topic_Info", topicInfoFactory);
        tag.put("city_list", cityListFactory);
        tag.put("city_info", cityInfoFactory);
        tag.put("view_show", viewShowFactory);
        tag.put("content_details", contentDetailsFactory);
        tag.put("content_select", contentSelectFactory);
        tag.put("cms_flagship_shop_list", flagshipShopListTag);
        tag.put("cms_district_list", districtListTag);
        return tag;
    }

}
